﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using MVCDemo.Models;

namespace MVCDemo.Data
{
    public class DataInitlizer : DropCreateDatabaseIfModelChanges<MVCDemoDb>
    {
        protected override void Seed(MVCDemoDb db)
        {
           
            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    Username="admin",
                    Password="123456"
                },new Users
                {
                    Username="lz",
                    Password="1234"
                },new Users
                {
                    Username="hy",
                    Password="0916"
                },new Users
                {
                    Username="dsk",
                    Password="123"
                },new Users
                {
                    Username="bb",
                    Password="123"
                }
            });

       
            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="躺在你学校的操场"
                },new Messages
                {
                    FromUserId=2,
                    Content="看星空"
                },new Messages
                {
                    FromUserId=3,
                    Content="教室里的灯还亮着"
                },new Messages
                {
                    FromUserId=4,
                    Content="你没走"
                },new Messages
                {
                    FromUserId=5,
                    Content="记得我写给你的情书"
                },new Messages
                {
                    FromUserId=2,
                    Content="都什么年代了"
                },new Messages
                {
                    FromUserId=4,
                    Content="到现在我还在写着"
                }
            });

    
            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    FromUserId=1,
                    MsgId=2,
                    Comment="总有一天总有一年"
                },new Comments
                {
                    FromUserId=4,
                    MsgId=5,
                    Comment="会发现"
                },new Comments
                {
                    FromUserId=3,
                    MsgId=2,
                    Comment="有人默默的陪在你的身边"
                },new Comments
                {
                    FromUserId=2,
                    MsgId=4,
                    Comment="也许我不该在你的世界"
                },new Comments
                {
                    FromUserId=3,
                    MsgId=3,
                    Comment="当你收到情书"
                },new Comments
                {
                    FromUserId=5,
                    MsgId=1,
                    Comment="也代表我已经走远"
                },
            });

           
            db.SaveChanges();

            
            base.Seed(db);
        }
    }
}